<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/9/17
 * Time: 11:39
 */
namespace app\libs;
use think\Config;
class HxSms
{
    const url ="http://sh2.ipyy.com/smsJson.aspx";
    public function send($mobiles,$content)
    {
        $userid=Config::get('hx.userid');
        $account=Config::get('hx.account');
        $password=Config::get('hx.password');
        $extno=Config::get('hx.extno');
        $sendtime=Config::get('hx.sendtime');
        $body=array(
            'action'=>'send',
            'userid'=>$userid,
            'account'=>$account,
            'password'=>$password,
            'mobile'=>$mobiles,
            'extno'=>$extno,
            'content'=>'【集商】：验证码：'.$content.' ，尊敬的用户您好，您正在进行手机验证，五分钟后失效。若不是本人操作，请忽略此信息！',
            'sendtime'=>$sendtime
        );
        $ch=curl_init();
        curl_setopt($ch, CURLOPT_URL, self::url);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
        $result = curl_exec($ch);
        curl_close($ch);
        return $result;
    }
}